﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

using WeChatDemo.Utils;
using WeChatDemo.Models.Photo;

namespace WeChatDemo.DataProvider.Photo
{
    public class DAOPhotoLike : DAOBase
    {
        private static string tableName = "PhotoLike";

        public static bool Add(PhotoLike model)
        {
            bool flag = false;

            string _sqlString = $"INSERT INTO [PhotoLike](ItemID, WechatOpenId) VALUES('{model.ItemID}', '{model.WechatOpenId}')";

            flag = SqlHelper.ExecuteNonQuery(_connectionString, CommandType.Text, _sqlString) == 0 ? false : true;

            return flag;
        }

        public static IEnumerable<PhotoLike> GetList(string queryExpression)
        {
            IEnumerable<PhotoLike> _list = ReaderToList<PhotoLike>(queryExpression, tableName);

            return _list;
        }
    }
}